﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AvantGameMachine.States
{
    public class StatesProvider
    {
        internal string currentState = string.Empty;

        public StatesProvider()
        {
        }

        public virtual void Update(string _currentState)
        {
        }

        public void ChangeState(string _newState)
        {
            if (currentState != string.Empty)
            {
                AGMPlatform.log.Debug(this.GetType().ToString() + ": Exiting state: " + currentState);
                ExitState(currentState);
            }

            currentState = _newState;
            if (currentState != string.Empty)
            {
                AGMPlatform.log.Debug(this.GetType().ToString() + ": Entering state: " + currentState);
                EnterState(currentState);
            }
        }

        public virtual void EnterState(string _newState)
        {

        }

        public virtual void ExitState(string _oldState)
        {
        }
    }
}
